package com.kyivmohyla.kma2.client.view.manager;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.*;
import com.google.gwt.user.datepicker.client.DateBox;
import com.kyivmohyla.kma2.client.presenter.manager.ManagerEditOrderPresenter;
import com.kyivmohyla.kma2.client.view.common.EquipmentCellTableWidget;
import com.kyivmohyla.kma2.client.view.common.OrderHistoryWidget;
import com.kyivmohyla.kma2.client.view.common.ServiceCellTableWidget;

public class ManagerEditOrderWindowView extends Composite implements ManagerEditOrderPresenter.Display {
    @UiField
    protected Label greeting;
    @UiField
    protected Button saveOrder;
    @UiField
    protected Button cancel;
    @UiField
    protected Button rejectToOperator;
    @UiField
    protected Button manageServices;
    @UiField
    protected Button manageEquipment;
    @UiField
    protected Button accessToEngineer;
    @UiField
    protected TextBox state;
    @UiField
    protected TextBox customerName;
    @UiField
    protected TextBox customerPhone;
    @UiField
    protected TextArea customerAddress;
    @UiField
    protected TextBox customerEmail;
    @UiField
    protected DateBox plannedDate;
    @UiField
    protected ListBox desStartTime;
    @UiField
    protected ListBox desEndTime;
    @UiField
    protected ListBox startTime;
    @UiField
    protected ListBox endTime;
    @UiField
    protected Label startTimeInfoLabel;
    @UiField
    protected TextArea commentary;
    @UiField
    protected TextBox myCommentary;
    @UiField
    protected ListBox engineerList;
    @UiField
    protected ServiceCellTableWidget serviceCellTable;
    @UiField
    protected EquipmentCellTableWidget equipmentCellTable;
    @UiField
    protected OrderHistoryWidget orderHistoryCellTable;

    private final static DateTimeFormat dateTimeFormat = DateTimeFormat.getFormat("MMM d, HH:mm");
    private final static DateTimeFormat dateFormat = DateTimeFormat.getFormat("dd.MM.yyyy");

    public ManagerEditOrderWindowView() {
        initWidget(ourUiBinder.createAndBindUi(this));
        greeting.setText("This is Order Editing And Assigning Window");
        plannedDate.setFormat(new DateBox.DefaultFormat(dateFormat));
    }

    @Override
    public HasText getState() {
        return state;
    }

    @Override
    public HasText getCustomerName() {
        return customerName;
    }

    @Override
    public HasText getCustomerPhone() {
        return customerPhone;
    }

    @Override
    public HasText getCustomerAddress() {
        return customerAddress;
    }

    @Override
    public HasText getCustomerEmail() {
        return customerEmail;
    }

    @Override
    public ListBox getDesStartTime() {
        return desStartTime;
    }

    @Override
    public ListBox getDesEndTime() {
        return desEndTime;
    }

    @Override
    public DateBox getPlannedDate() {
        return plannedDate;
    }

    @Override
    public ListBox getStartTime() {
        return startTime;
    }

    @Override
    public ListBox getEndTime() {
        return endTime;
    }

    @Override
    public HasText getStartTimeInfoLabel() {
        return startTimeInfoLabel;
    }

    @Override
    public HasText getCommentary() {
        return commentary;
    }

    @Override
    public HasText getMyCommentary() {
        return myCommentary;
    }

    @Override
    public ListBox getEngineerList() {
        return engineerList;
    }

    @Override
    public HasClickHandlers getManageServicesButton() {
        return manageServices;
    }

    @Override
    public HasClickHandlers getManageEquipmentButton() {
        return manageEquipment;
    }

    @Override
    public HasClickHandlers getSaveOrderButton() {
        return saveOrder;
    }

    @Override
    public HasClickHandlers getCancelButton() {
        return cancel;
    }

    @Override
    public HasClickHandlers getRejectToOperatorButton() {

        return rejectToOperator;
    }

    @Override
    public HasClickHandlers getAccessToEngineerButton() {
        return accessToEngineer;
    }

    @Override
    public ServiceCellTableWidget getServiceCellTable() {
        return serviceCellTable;
    }

    @Override
    public EquipmentCellTableWidget getEquipmentCellTable() {
        return equipmentCellTable;
    }

    @Override
    public OrderHistoryWidget getOrderHistoryCellTable() {
        return orderHistoryCellTable;
    }

    @Override
    public Widget asWidget() {
        return this;
    }

    interface ManagerEditOrderWindowViewUiBinder extends UiBinder<Widget, ManagerEditOrderWindowView> {
    }

    private static ManagerEditOrderWindowViewUiBinder ourUiBinder = GWT.create(ManagerEditOrderWindowViewUiBinder.class);
}